<?php

class Application_Form_FRejestracja extends Zend_Form {

    public function init() {
        try {
            $this->setMethod('post');

            $view = Zend_Layout::getMvcInstance()->getView();
            $url = $view->url(array(
                'controller' => 'panel-klienta', 'action' => 'rejestracja'
                    ));
            $this->setAction($url);


            $login = new Zend_Form_Element_Text('login');
            $login->setRequired('true')
                    ->setAttrib('class', 'inputbox')
                    ->setAttrib('id', 'login_reje')
                    ->addFilter('StripTags')
                    ->addFilter('StringTrim')
                    ->removeDecorator('label')
                    ->removeDecorator('HtmlTag');
            $this->addElement($login);

            $password = new Zend_Form_Element_Password('password');
            $password->setRequired('true')
                    ->setAttrib('class', 'inputbox')
                    ->setAttrib('id', 'password_reje')
                    ->addFilter('StripTags')
                    ->addFilter('StringTrim')
                    ->removeDecorator('label')
                    ->removeDecorator('HtmlTag');
            $this->addElement($password);

            $imie = new Zend_Form_Element_Text('imie');
            $imie->setRequired('true')
                    ->setAttrib('class', 'inputbox')
                    ->addFilter('StripTags')
                    ->addFilter('StringTrim')
                    ->removeDecorator('label')
                    ->removeDecorator('HtmlTag');
            $this->addElement($imie);

            $nazwisko = new Zend_Form_Element_Text('nazwisko');
            $nazwisko->setRequired('true')
                    ->setAttrib('class', 'inputbox')
                    ->addFilter('StripTags')
                    ->addFilter('StringTrim')
                    ->removeDecorator('label')
                    ->removeDecorator('HtmlTag');
            $this->addElement($nazwisko);

            $email = new Zend_Form_Element_Text('email');
            $email->setAttrib('class', 'inputbox')
                    ->removeDecorator('label')
                    ->removeDecorator('HtmlTag')
                    ->addFilters(array('StringTrim', 'StripTags'))
                    ->addValidator('EmailAddress', TRUE);
            $this->addElement($email);

            $captcha = $this->createElement('captcha', 'captcha', array('required' => true,
                'captcha' => array('captcha' => 'Image',
                    'font' => APPLICATION_PATH . '/../data/jmr.ttf',
                    'fontSize' => '28',
                    'wordLen' => 5,
                    'height' => '70',
                    'width' => '150',
                    'imgDir' => APPLICATION_PATH . '/../public/captcha',
                    'imgUrl' => Zend_Controller_Front::getInstance()->getBaseUrl() .
                    '/captcha',
                    'dotNoiseLevel' => 40,
                    'lineNoiseLevel' => 5)));
            $captcha->setAttrib('class', 'inputbox');
            $this->addElement($captcha);

            $submit = new Zend_Form_Element_Submit('submit', 'ZAREJESTRUJ');
            $submit->setRequired('true')
                    ->setAttrib('class', 'button')
                    ->addFilter('StripTags')
                    ->addFilter('StringTrim')
                    ->removeDecorator('label')
                    ->removeDecorator('HtmlTag')
                    ->removeDecorator('DtDdWrapper');
            $this->addElement($submit);
        } catch (Exception $e) {
            Zend_Debug::dump($e);
        }
    }

}

